package com.zto.sch.advance.designpattern.daili;

class Proxy implements Subject {
    private Subject subject;

    @Override
    public void request() {
        if (subject == null) {
            subject = new RealSubject();
        }
        preRequest();
        subject.request();
        postRequest();
    }

    public void preRequest() {
        System.out.println("访问真实主题之前的预处理。");
    }

    public void postRequest() {
        System.out.println("访问真实主题之后的后续处理。");
    }
}